package com.example.block_chain.utils;

import java.util.UUID;

/*
 *@description: UUID生成器
 *@author: hisen
 *@Time: 2023/10/27  1:53
 */
public class UidUtil {
    public static String getUid(int length) {
        String uuid = UUID.randomUUID().toString().replace("-", "");
        if (uuid.length() >= length) {
            return uuid.substring(0, length);
        } else {
            return uuid;
        }
    }

    public static String getUid() {
        return UUID.randomUUID().toString().replace("-", "");
    }
}
